#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
void test01()
{
	vector<int> v1;
	vector<int> v2(10, 1);
	vector<int> v3(++v2.begin(), --v2.end());

	for (size_t i = 0; i < v3.size(); i++)
	{
		cout << v3[i] << " ";
	}
	cout << endl;

	vector<int>::iterator it = v3.begin();
	while (it != v3.end())
	{
		cout << *it;
		it++;
	}

	for (auto ch : v3)
	{
		cout << ch << endl;
	}
}

void test02()
{
	vector<int> v(10, 1);
	cout << v.size() << endl;
	cout << v.capacity() << endl;
}

void test03()
{
	vector<int> v(10, 1);
	v.push_back(10);
	v.insert(v.begin(), 2);
	for (auto ch : v)
	{
		cout << ch << " ";
	}
	cout << endl;

	v.insert(v.begin() + 3, 88);
	for (auto ch : v)
	{
		cout << ch << "  ";
	}
	cout << endl;
}

void test04()
{
	vector<int> v1(10, 0);
	for (size_t i = 0; i < 5; i++)
	{
		cin >> v1[i];
	}
	for (auto ch : v1)
	{
		cout << ch << ",";
	}
	cout << endl;

}

void test05()
{
	vector<string> v1;
	string s2("hello world");
	v1.push_back(s2);
	v1.push_back("yyyyyy");
	for (const auto& ch : v1)
	{
		cout << ch;
	}
	cout << endl;
}

void test06()
{
	vector<int> array;
	array.push_back(100);
	array.push_back(300);
	array.push_back(300);
	array.push_back(300);
	array.push_back(300);
	array.push_back(500);
	vector<int>::iterator itor;
	for (itor = array.begin(); itor != array.end(); itor++)
	{
		if (*itor == 300)
		{
			itor = array.erase(itor);
		}
	}
	for (itor = array.begin(); itor != array.end(); itor++)
	{
		cout << *itor << " ";
	}
}

void test07()
{
	{

		int ar[] = { 1,2,3,4,5,6,7,8,9,10 };

		int n = sizeof(ar) / sizeof(int);

		vector<int> v(ar, ar + n);

		cout << v.size() << ":" << v.capacity() << endl;

		v.reserve(100);

		v.resize(20);

		cout << v.size() << ":" << v.capacity() << endl;

		v.reserve(50);

		v.resize(5);

		cout << v.size() << ":" << v.capacity() << endl;

	}
}

void test08()
{

}
int main()
{
	test07();
	return 0;
}